<?php

use Phalcon\Mvc\Controller;

class UploadController extends Controller
{
    public function indexAction()
    {
    	echo 1111;
    	//$this->view->pick("upload/index");
    	// if($this->request->isPost()){
    	// 	$release = new Release();
    	// 	$success = $release->save($this->request->getPost(),[
    	// 		'version',
    	// 		'env',
    	// 		'description'
    	// 	]);
    	// 	if ($success) {
	    //         echo "Thanks for registering!";
	    //     } else {
	    //         echo "Sorry, the following problems were generated: ";

	    //         $messages = $user->getMessages();

	    //         foreach ($messages as $message) {
	    //             echo $message->getMessage(), "<br/>";
	    //         }
	    //     }

    	// }
    }

    public function apkAction()
    {
    	if ($this->request->hasFiles()) {
            $files = $this->request->getUploadedFiles();

            // Print the real file names and sizes
            foreach ($files as $file) {
                // Print file details
                echo $file->getName(), " ", $file->getSize(), "\n";

                // Move the file into the application
                $file->moveTo(
                    "apk/" . $file->getName()
                );
            }
        }
    }
}